package Tree;

public class BTree {
	
		char info;
		BTree lt;
		BTree rt;
		
		BTree()
		{ 
			lt = null; 
			rt = null; 
		}

	public static BTree Create()
	{
		return null;
	}

	public static boolean isNull(BTree b)
	{
		return (b == null);
		
	}
	
	public static char RootBT(BTree b)
	{
		if (b == null) 
		{ 
			System.out.println("Error: RootBT(null)");
			System.exit(1);
		}
		else return b.info;
		return b.info;
	}
	
	public static BTree Left(BTree b)
	{
		if (b == null) 
		{ 
			System.out.println("Error: Left(null)");
			System.exit(1);
		}
		else return b.lt;
		return b.lt;
	}
	
	public static BTree Right(BTree b)
	{
		if (b == null) 
		{ 
			System.out.println("Error: Right(null)");
			System.exit(1);
		}
		else return b.rt;
		return b.rt;
	}
	
	public static BTree ConsBT(char x, BTree lst, BTree rst)
	{
		BTree p;
		p = new BTree();
		if (p != null)
		{
			p.info = x;
			p.lt = lst;
			p.rt = rst;
			return p;
		}
		else
		{
			System.out.println("Memory not enough");
			System.exit(1);
		}
		return p;
	}
}
